using System;
using System.Collections.Generic;
using System.Text;
using CreamX.Framework.SceneGraph;




namespace CreamX.Framework.Game.Components
{
    /// <summary>
    /// Base CreamXComponent. All CreamX components will inherit from this class. 
    /// </summary>
    public abstract class CreamXComponent:ICloneable
    {
        #region Private Variables
        private CreamXObject _sceneObject;
        private bool _enabled;
        #endregion

        #region Public Methods
        public virtual void Update(float elapsed)
        { 
        }
        public virtual void OnRegister()
        {}
        public virtual void OnUnRegister()
        { }
        #endregion

        #region Public Properties
        /// <summary>
        /// The Scene object the component is a member of
        /// </summary>
        public CreamXObject SceneObject
        {
            get { return _sceneObject; }
            set { _sceneObject = value; }
        }

        /// <summary>
        /// Gets or sets wether the component is enabled. Update method is only called on Enabled components
        /// </summary>
        /// <remarks>Enables is false by default</remarks>
        public bool Enabled
        {
            get { return _enabled; }
            set { _enabled = value; }
        }

        /// <summary>
        /// The current scene the owner of the component is in
        /// </summary>
        public CreamXSceneData CurrentScene
        {
            get
            {
                return SceneObject.Scene;
            }
        }
        #endregion

        #region ICloneable Members

        public virtual object Clone()
        {
            return MemberwiseClone();
        }
        #endregion
    }

   
}
